/*
===========================================================================
Copyright (C) 2013-2014 Avotu Briezhaudzetava

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.

===========================================================================
*/

#ifndef COMMON_H
#define COMMON_H

//
// includes
//
#include <QObject>
#include <QString>

// message macro
#ifdef Q_CC_MSVC
#define ClassFunc QString( "%1::%2: " ).arg( this->metaObject()->className()).arg( __FUNCTION__ )
#else
#define ClassFunc QString( "%1::%2: " ).arg( this->metaObject()->className()).arg( __func__ )
#endif

// error message macros
#define StrMsg ClassFunc
#define StrFatalError Main::FatalError, ClassFunc
#define StrSoftError Main::SoftError, ClassFunc
#define StrWarn QObject::trUtf8( "WARNING:" ) + ClassFunc

//
// namespace: Common
//
namespace Common {
    const static unsigned int API = 1;
    const static unsigned int MinimumAPI = 1;
    const static QString defaultDBFilename( "precursors.db" );
    const static QString superUserName( "Overseer" );
    const static QString superUserPassword( "trebuchet" );

    // measurement units
    enum Units {
        Grams,
        Kilograms,
        Millilitres,
        Litres
    };
    const static QString UnitsStrings[] = {
        QObject::trUtf8( "g" ),
        QObject::trUtf8( "kg" ),
        QObject::trUtf8( "mL" ),
        QObject::trUtf8( "L" ),
    };
    const static int numUnits = sizeof( UnitsStrings ) / sizeof( QString );
}

#endif // COMMON_H
